import PageBase from "../../pages/PageBase";
import TabBar, { Hv, Tab, TabConfig } from "../../core/TabBar";
import MainPageBox from "./MainPageBox";

/**
 * 全局标签页
 */
export default class GlobalTabBar extends TabBar{
    pageBox:MainPageBox
    constructor(props:GlobalTabBarConfig){
        super(props)
        this.pageBox=props.pageBox;
    }
    showLoading(){
        this.pageBox.showLoading();
    }
    hideLoading(){
        this.pageBox.hideLodding();
    }
    beforeRender(): void {
        this.style.width="100%";
        super.beforeRender();
    }
}

export interface GlobalTabBarConfig{
    pageBox:MainPageBox
    hv?:Hv
}

export class GlobalTab extends Tab{
    bar?:GlobalTabBar
    hideLoading(){
        if(!this.bar){
            throw new Error("标签脱离组织！！")
        }
        this.bar.hideLoading();
        alert("hide")
    }
}

export interface GlobalTabConfig extends TabConfig{
    bar?:GlobalTabBar
}